
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <script src="../../../res/js/util.js"></script>
    <script src="../../../res/js/jquery-3.1.1.min.js"></script>
    <link rel="stylesheet" href="../../../res/layui/css/layui.css">
    <link rel="stylesheet" href="../../../res/css/styles.css" type="text/css" media="all"/>
</head>

<body style="background:#f5f5f5;">
<ul id="cardArea" class="card-area clearfix" >
    <li class="card-item active">
        <div class="card">
            <div class="card-title title-even" style="left: 200px;width: 680px;text-align: center;">
                <div class="content"><h1 id="e"></h1></div>
            </div>

            <div class="card-content content-second">
                <div class="main-info">
                    <ul>
                        <li>
                            <div class="left">
                                <p class="tit" id="a"></p>收到
                                <p class="hys" id="b" style=" color: black; width: 1000px; font-size: 20px; text-align: center"></p>
                                <p class="zbc" id="d" style="font-size: 18px ;color: red" ></p>
                                <p>
                                    <input type="text" placeholder=""  style="height: 34px;width: 550px;"  id="comments">
                                    <button type="button" value="发送" style="margin-top: -66px;width: 80px; margin-left: 615px;" class="layui-btn layui-btn-primary" id="btn">发送</button>
                                <div  id="zkai" style="    margin-top: -66px;
    width: 80px;
    margin-left: 853px;">展开回复 ˇ</div>

                                <div id="ifrom" style="text-align: center;
    font-size: 25px;
    margin-left: 50px;
    margin-top: 60px;
    width: 940px;">
                                </div>
                                </p>
                            </div>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </li>
</ul>


<script src="../../../res/layui/layui.js"></script>
<script>
    layui.use(['form','laydate', 'laypage', 'layer', 'table', 'upload', 'element'], function() {
        layer = layui.layer
        $(function () {
            url = "/inform/selectOne";
            data = {informId: getQueryString('informId')};
            $.post(url, data, function (obj) {
                $("#e").text(obj.informName);
                $("#a").text(obj.tname);
                $("#b").append("<div>"+obj.informContent+"</div>");
                $("#d").text(obj.informTime);
            }, "json")
            setInterval(function () {
                url ="/discuss/selectOne"
                ds = {informId: getQueryString('informId')}
                $.post(url,ds,function (obj) {
                    $("#ifrom").text("")
                    $.each(obj,function(index,item){
                        $("#ifrom").append("<div style='background-image: url("+item.operImg+");\n" +
                            "    height: 60px;\n" +
                            "    width: 60px;\n" +
                            "    border-radius: 100%;'></div>" +
                            "<div style='    margin-top: -20px;\n" +
                            "    margin-left: 70px;'>"+item.oper+"</div>" +
                            "<div style='width: 310px;'>"+item.img+"</div>" +
                            "<p style='font-family: -webkit-pictograph;\n" +
                            "    width: 900px;\n" +
                            "    margin-top: 15px;\n" +
                            "    font-size: 18px;\n" +
                            "    margin-left: 50px;\n" +
                            "    border: 1px solid sienna;\n" +
                            "    border-radius: 13px;'>"+item.comments +"" +
                            "</p>");
                    })
                    if( $("#ifrom").text()==""){
                        $("#ifrom").text("暂无回复")
                    }

                })
                console.info("123")
            }, 1000);//8秒自动刷新



        })

        $("#btn").on("click", function () {
            url = "/discuss/insertOn";
            data = {informId: getQueryString('informId'), comments: $("#comments").val()}
            $.post(url, data, function (obj) {
                 layer.msg(obj.message);
            }, "json")

            $("#comments").val("");
        })

        $("#ifrom").hide();

        var ik = 0 ;

        $("#zkai").on("click",function(){
           ik++
            if (ik%2==0){
                $("#ifrom").hide();
            }else if (ik%2==1){
                $("#ifrom").show();
            }
        })


    });
</script>
</body>
</html>
